{include file="public/header"}
<style>
    #des{
        position: relative;
        z-index: 0;
    }
</style>
<form class="layui-form" lay-filter="layuiadmin-form-useradmin" id="layuiadmin-form-useradmin" style="padding: 20px 20px 20px 0;">
    <div class="layui-form-item">
        <label class="layui-form-label">商品名称</label>
        <div class="layui-input-block">
            <input value="" type="text" name="name" placeholder="请输入商品名称" autocomplete="off" class="layui-input" lay-verify="required">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">商品类型</label>
        <div class="layui-input-block">
            <select name="type">
                <option value="1">级差1</option>
                <option value="2">级差2</option>
            </select>
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">封面</label>
        <div class="layui-upload">
            <button type="button" class="layui-btn uploadImage" lay-data="1">选择图片</button>
            <div class="layui-input-block">
                <img class="layui-upload-img uploadImage" src="" style="width: 100px;">
                <input type="hidden" name="cover" id="cover" value="">
                <p id="uploadText"></p >
            </div>
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">规格</label>
        <div class="layui-input-block">
            <input value="" type="text" name="attr" placeholder="例如：500g*4" autocomplete="off" class="layui-input" lay-verify="required">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">市场价</label>
        <div class="layui-input-block">
            <input value="" type="text" name="market_amount" placeholder="请输入商品市场价" autocomplete="off" class="layui-input" lay-verify="required">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">普通用户价格</label>
        <div class="layui-input-block">
            <input value="" type="text" name="sale_amount" placeholder="请输入商品普通用户价格" autocomplete="off" class="layui-input" lay-verify="required">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">会员价格</label>
        <div class="layui-input-block">
            <input value="" type="text" name="sale_amount1" placeholder="请输入商品会员价格" autocomplete="off" class="layui-input" lay-verify="required">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">县代价格</label>
        <div class="layui-input-block">
            <input value="" type="text" name="sale_amount2" placeholder="请输入商品县代价格" autocomplete="off" class="layui-input" lay-verify="required">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">市代价格</label>
        <div class="layui-input-block">
            <input value="" type="text" name="sale_amount3" placeholder="请输入商品市代价格" autocomplete="off" class="layui-input" lay-verify="required">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">省代价格</label>
        <div class="layui-input-block">
            <input value="" type="text" name="sale_amount4" placeholder="请输入商品省代价格" autocomplete="off" class="layui-input" lay-verify="required">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">合伙人价格</label>
        <div class="layui-input-block">
            <input value="" type="text" name="sale_amount5" placeholder="请输入商品合伙人价格" autocomplete="off" class="layui-input" lay-verify="required">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">库存</label>
        <div class="layui-input-block">
            <input value="" type="text" name="stock" placeholder="请输入商品库存" autocomplete="off" class="layui-input" lay-verify="required">
        </div>
    </div>


<!--    <div class="layui-form-item">-->
<!--        <label class="layui-form-label">上传视频</label>-->
<!--        <div class="layui-input-block">-->
<!--            <button type="button" class="layui-btn" id="video">-->
<!--                <i class="layui-icon">&#xe67c;</i>上传视频-->
<!--            </button>-->
<!--        </div>-->
<!--    </div>-->



    <div class="layui-form-item layui-hide">
        <input type="button" lay-submit lay-filter="LAY-user-front-submit" id="LAY-user-front-submit" value="确认">
    </div>
</form>

<script src="__ADMIN__/layuiadmin/layui/layui.js"></script>
<script type="text/javascript">
    window.HOST_TYPE='2'
</script>
<script>
    layui.config({
        base: '__ADMIN__/layuiadmin/' //静态资源所在路径
    }).extend({
        index: 'lib/index' //主入口模块
    }).use(['form', 'upload', 'layer'], function(){
        var $ = layui.$
            ,form = layui.form
            ,upload = layui.upload
            ,layer = layui.layer;

        //执行实例
        // var uploadInst = upload.render({
        //     elem: '#video', //绑定元素
        //     url: 'v2/upload_file', //上传接口
        //     // data: {key: $(this).attr('data-type')},
        //     accept: 'video',
        //     done: function(res) {
        //         console.log(res);
        //         //上传完毕回调
        //         // $('#' + res.data.key).val(res.data.val); //将图片路径保存到表单中
        //         // $('.' + res.data.key).attr('src', res.data.src); //预览图片
        //         // // $('#uploadText').html('上传成功');
        //         // layer.msg(res.msg, {icon: 1});
        //     },
        //     error: function() {
        //         //请求异常回调
        //         layer.msg('上传失败', {icon: 2});
        //     }
        // });

        //执行实例
        var uploadImage = upload.render({
            elem: '.uploadImage', //绑定元素
            url: '/api/app/uploads/files', //上传接口
            data: {folder: 'goods/images'},
            accept: 'images',
            done: function(res) {
                console.log(res);
                //上传完毕回调
                $('#cover').val(res.data.val); //将图片路径保存到表单中
                $('.uploadImage').attr('src', res.data.src); //预览图片
                $('#uploadText').html('上传成功');
                layer.msg(res.msg, {icon: 1});
            },
            error: function() {
                //请求异常回调
                layer.msg('上传失败', {icon: 2});
            }
        });
    })
</script>
{include file="public/footer"}